package com.tuling.jucdemo.hashmap;

import java.util.concurrent.ConcurrentHashMap;

/**
 * @author :tangweiliang
 * @date : 2022/12/2 23:04
 * 未来的你会感谢现在努力的自己
 */
public class ConcurrentHashDemo {
    public static void main(String[] args) {
        ConcurrentHashMap<String,String> concurrentHashMap = new ConcurrentHashMap<>();
        concurrentHashMap.put("123", "2");
        System.out.println(concurrentHashMap.get("123"));

        concurrentHashMap.putIfAbsent("123", "3"); // 如果当前concurrenthashmap里已经有123这个key了,那就什么都不做

    }
}
